Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tabbed content widget #2059

Merged
merged 26 commits into from
Mar 18, 2023
Merged

tabbed content widget #2059

merged 26 commits into from
Mar 18, 2023

Conversation

willmcgugan
Copy link
Collaborator

@willmcgugan willmcgugan commented Mar 14, 2023

  • Adds TabbedContent widget
  • Adds TabPane widget
  • New Tabs.TabCleared message
  • Adds get_child_by_type method
Screen.Recording.2023-03-17.at.09.18.49.mov

@willmcgugan willmcgugan marked this pull request as draft March 14, 2023 18:06
@willmcgugan willmcgugan changed the title WIP tabbed content widget tabbed content widget Mar 17, 2023
@willmcgugan willmcgugan marked this pull request as ready for review March 17, 2023 09:20
Copy link
Contributor

@davep davep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple or so small documentation things, but also a couple of errors that seem like they're easily fixed.

I feel this also deserves some dedicated unit tests too given that this is a fairly involved container, testing the messages and the like, and also testing things like TabbedContent inside TabbedContent, etc (I did try that "by hand" and seems fine once the issue around pulling back the ContentSwitcher was fixed).

Overall though this is really nice! Looks and feels nice and smooth.

docs/widgets/tabbed_content.md Outdated Show resolved Hide resolved
src/textual/dom.py Outdated Show resolved Hide resolved
src/textual/widget.py Show resolved Hide resolved
src/textual/widgets/_content_switcher.py Outdated Show resolved Hide resolved
src/textual/widgets/_tabbed_content.py Show resolved Hide resolved
src/textual/widgets/_tabbed_content.py Outdated Show resolved Hide resolved
docs/widgets/tabbed_content.md Show resolved Hide resolved
docs/widgets/tabbed_content.md Show resolved Hide resolved
src/textual/widgets/_tabbed_content.py Show resolved Hide resolved
src/textual/widgets/_tabbed_content.py Outdated Show resolved Hide resolved
@davep
Copy link
Contributor

davep commented Mar 18, 2023

Random thought while playing with this some more: I feel like it might be a good idea to have home and end bindings on tabs to support easily going to the first/last tab (I realise this isn't an issue for this particular PR, but playing with this fully had my hitting them more than once out of habit).

@willmcgugan
Copy link
Collaborator Author

@davep Added some tests. The new pilot.click is awesome.


| Name | Type | Default | Description |
| -------- | ----- | ------- | -------------------------------------------------------------- |
| `active` | `str` | `""` | The `id` attribute of the active tab. Set this to switch tabs. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last nit... as of 2ede38f this needs to show that it can be None.

@davep
Copy link
Contributor

davep commented Mar 18, 2023

Added some tests. The new pilot.click is awesome.

@willmcgugan Looks good! I suspect I'll be giving pilot.click a workout with the menu stuff too; looking forward to it.

For the sake of completeness I think I'd be temped to add a tabs-within-tabs test (given that caused an error initially and could possibly be a source of regression at some point), but that's your call.

Looking good! Looks very mergeable to me now!

@willmcgugan willmcgugan merged commit f5e779c into main Mar 18, 2023
@willmcgugan willmcgugan deleted the tabbed-content branch March 18, 2023 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants